package com.cskaoyan.controller.wx;

import com.cskaoyan.bean.BaseRespVo;
import com.cskaoyan.bean.FootPriceList;
import com.cskaoyan.service.AdminFootprintService;
import com.cskaoyan.service.wx.WxFeedbackService;
import com.cskaoyan.service.wx.WxFootprintService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;
import java.util.Map;

/**
 * @author pengyehua
 * @date 2020/12/9 10:52
 */

/**
 * 足迹模块
 */
@RestController
@RequestMapping("wx/footprint")
public class WxFootprintController {

    @Autowired
    WxFootprintService wxFootprintService;

    /**
     * 查询足迹
     * @param page
     * @param size
     * @return
     */
    @RequestMapping("list")
    public BaseRespVo list(int page, int size, HttpSession session){
        String name =(String) session.getAttribute("name");
        FootPriceList footPriceList = wxFootprintService.queryFootprint(page,size,name);
        return BaseRespVo.ok(footPriceList);
    }

    /**
     * 删除足迹
     * @param map
     * @return
     */
    @RequestMapping("delete")
    public BaseRespVo delete(@RequestBody Map map){
        Integer id =(Integer) map.get("id");
        wxFootprintService.deleteFootprint(id);
        return BaseRespVo.ok();
    }
}
